-
-
Notifications
You must be signed in to change notification settings - Fork 92
eslint: make --fix remove unused imports
#1076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
eslint: make --fix remove unused imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat! I am definitely supportive of this direction
I think we need to tweak the ignore comments for most of these unused imports, though; see inline comment.
Also see #640; would be good to get this into pre-commit if easy
|
Yeah, I definitely did take a look at #640 :). A quick naive implementation had it making a bunch of changes, so I stopped for now. Will update the tagging on the existing imports. |
991f18e to
4d64561
Compare
|
I've tagged the existing unused imports with |
|
From the meetup: we looked at https://github.com/import-js/eslint-plugin-import briefly but didn't see a rule for removing unused imports. no-unused-modules seems to be more about finding exports in your own modules that aren't used. @auscompgeek let me know if I missed it. If there is, we can use it. Otherwise, this should be ready to merge and we can take a look at adding some of eslint-plugin-import's rules as a follow up change, as I imagine that would be valuable in their own right. |
|
@auscompgeek @pokey can we merge this? |
pokey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍👍
I noticed that
eslint --fixdidn't remove unused imports andeslint src --ext tscomplained with a warning about an existing unused one:I imagine this is because most people are fixing this up using the Visual Studio Code action, but it's nice to have everything working from the command line. Also JetBrains will only do it if
eslint --fixdoes, hence my motivation :)This adds the configuration such that
eslint src --ext ts --fixremoved unused imports, and fixes the existing unused imports in the codebase. Let me know if I made a mistake.Checklist